/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package geneticprogramming;

import areaCircle.CircleAreaParams;
import formula.FormulaProblem;
import formula.FormulaProblemParams;
import geneticprogramming.algorithm.GeneticAlgorithm;
import geneticprogramming.problem.GEProblem;
import geneticprogramming.problem.GEProblemParams;
import geneticprogramming.problem.Individual;
import string.StringProblem;

/**
 *
 * @author CJ
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

//        runString();
        runExpression();

    }

    public static void runExpression(){
        FormulaProblemParams params = CircleAreaParams.getFormulaParams();
        FormulaProblem problem = new FormulaProblem(params);
        GEProblemParams geParams = CircleAreaParams.getGEParams();
        System.out.println(GeneticAlgorithm.run(geParams, problem));
    }

    public static void runString(){
        String lorem = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

        double maxMutate = 100;
        double minMutate = 5;

        GEProblem problem = new StringProblem(lorem, maxMutate, minMutate);

        int maxGeneration = -1;
        int population = 1000;
        int displayFreq = 1000;
        double retain = 0.0;
        int maxReMates = 10;
        GEProblemParams params = new GEProblemParams(maxGeneration, population, displayFreq, maxReMates);
        System.out.println(GeneticAlgorithm.run(params, problem));
    }

}
